<template>
  <div id="app" v-bind:style="appDivStyle">
      <div class="context" ref="context">
           <div class="queryBox" ref="queryBox">
                <el-form :inline="true" :model="formQueryCondition"
                         ref="form" size="mini">
                    <!--查询条件-->
                    <!--频道编号-->
                    <el-form-item :label="$t('channelTurnDown.queryLabel.channelId')"
                    :label-width="queryformLabelWidth">
                        <el-input v-model.trim="formQueryCondition.code.val" class="queryItemStyle" clearable
                                  :placeholder="$t('channelTurnDown.queryLabel.placeholderChannelId')"></el-input>
                    </el-form-item>
                    <!--频道名称-->
                    <el-form-item :label="$t('channelTurnDown.queryLabel.channelName')"   :label-width="queryformLabelWidth">
                        <el-input v-model.trim="formQueryCondition.name.val" class="queryItemStyle" clearable
                                  :placeholder="$t('channelTurnDown.queryLabel.placeholderChannelName')">
                        </el-input>
                    </el-form-item>
                    <!--频道来源-->
                    <!-- <el-form-item :label="$t('channelTurnDown.queryLabel.source')"  :label-width="queryformLabelWidth">
                        <el-select v-model="formQueryCondition.source.val" class="queryItemStyle">
                            <el-option :label="$t('ParentAssetIssuance.label.all')" value=""></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource1')" value="shellAssetsSource1"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource2')" value="shellAssetsSource2"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource3')" value="shellAssetsSource3"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource4')" value="shellAssetsSource4"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource5')" value="shellAssetsSource5"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource6')" value="shellAssetsSource6"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource7')" value="shellAssetsSource7"></el-option>
                        </el-select>
                    </el-form-item> -->
                    <!--频道类型-->
                    <!-- <el-form-item :label="$t('channelTurnDown.queryLabel.type')"  :label-width="queryformLabelWidth">
                        <el-select v-model="formQueryCondition.type.val" class="queryItemStyle">
                            <el-option :label="$t('ParentAssetIssuance.label.all')" value=""></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType1')" value="shellAssetsType1"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType2')" value="shellAssetsType2"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType3')" value="shellAssetsType3"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType4')" value="shellAssetsType4"></el-option>
                        </el-select>
                    </el-form-item> -->
                    <!--频道状态-->
                    <!-- <el-form-item :label="$t('channelTurnDown.queryLabel.status')"  :label-width="queryformLabelWidth">
                        <el-select v-model="formQueryCondition.status.val" class="queryItemStyle">
                            <el-option :label="$t('ParentAssetIssuance.label.all')" value=""></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsStatus1')" value="shellAssetsStatus1"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsStatus2')" value="shellAssetsStatus2"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsStatus3')" value="shellAssetsStatus3"></el-option>
                            <el-option :label="$t('ParentAssetIssuance.label.shellAssetsStatus4')" value="shellAssetsStatus4"></el-option>
                        </el-select>
                    </el-form-item> -->
                    <!--创建时间-->
                    <!-- <el-form-item :label="$t('channelTurnDown.queryLabel.createTime')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.createTimeStart.val" class="queryItemStyle"
                                        type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item :label="$t('ParentAssetIssuance.label.zhi')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.createTimeEnd.val" class="queryItemStyle"
                                        type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                    </el-form-item> -->

                    <!--修改时间-->
                    <!-- <el-form-item :label="$t('channelTurnDown.queryLabel.lastUpdateTime')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.lastUpdateTimeStart.val" class="queryItemStyle"
                                        type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                    </el-form-item>
                    <el-form-item :label="$t('ParentAssetIssuance.label.zhi')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.lastUpdateTimeEnd.val" class="queryItemStyle"
                                       type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                    </el-form-item> -->

                    <!--授权到期时间-->
                    <el-form-item :label="$t('channelTurnDown.queryLabel.liveStartTime')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.expireTime.val" class="queryItemStyle"
                                        type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                    </el-form-item>
                    <el-form-item :label="$t('ParentAssetIssuance.label.zhi')"  :label-width="queryformLabelWidth">
                        <el-date-picker v-model="formQueryCondition.expireEndTime.val" class="queryItemStyle"
                                         type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                    </el-form-item>


                    <!--列表上面的按钮-->
                    <div style="text-align:right">
                        <!--新增-->
                        <!-- <el-form-item>
                            <el-button type="primary" @click="onNew">{{ $t('ParentAssetIssuance.btnText.newBtnText') }}</el-button>
                        </el-form-item> -->
                        <!--重置-->
                        <el-form-item>
                            <el-button type="primary" @click="onReset('form')">{{ $t('ParentAssetIssuance.btnText.resetBtnText') }}</el-button>
                        </el-form-item>
                        <!--批量下发-->
                        <el-form-item>
                            <el-button type="primary" @click="recoverys('feom')">批量下发</el-button>
                        </el-form-item>
                        <!--导入-->
                        <el-form-item>
                            <el-button type="primary" @click="onExport" icon="el-icon-upload2" :loading="loading">{{ $t('ParentAssetIssuance.btnText.ImportBtnText') }}</el-button>
                        </el-form-item>
                        <!--导出-->
                        <el-form-item>
                            <el-button type="primary" @click="onExport" icon="el-icon-download" :loading="loading">{{ $t('ParentAssetIssuance.btnText.exportBtnText') }}</el-button>
                        </el-form-item>
                        <!--查询-->
                        <el-form-item>
                            <el-button type="primary" @click="onQuery" icon="el-icon-search" :loading="loading">{{ $t('ParentAssetIssuance.btnText.queryBtnText') }}</el-button>
                        </el-form-item>
                    </div>
                </el-form>
            </div>
            <!--列表-->
            <div class="dataBox" ref="dataBox">

                <el-table v-if="isInit" ref="singleTable"
                            :data="tableData"
                            :height="tableHeight"
                            @sort-change="sortChange"
                            v-loading="loading" size="mini"
                            style="width: 100%;" stripe=stripe border=border>
                    <!--序号-->
                    <!-- <el-table-column type="index"  width="50" fixed="left"
                                        :label="$t('table.xh')" align="center">
                    </el-table-column> -->
                    <!--复选框-->
                    <el-table-column type="selection" align="center" width="35" fixed="left">
                    </el-table-column>
                    <!--操作-->
                    <el-table-column :label="$t('table.op')" fixed="left" min-width="200">
                        <template slot-scope="scope">
                            <!--频道详情-->
                            <el-button size="gv" icon="el-icon-tickets" :loading="loading"
                             @click="clickDetails(scope.$index, scope.row)"
                                        >{{ $t('ParentAssetIssuance.btnText.detailsBtnText') }}</el-button>
                            <!--查看节目单-->
                            <el-button size="gv" icon="el-icon-tickets" :loading="loading"
                             @click="onPlayBill(scope.$index, scope.row)"
                                        >{{$t('channelTurnDown.table.programList')}}</el-button>
                            <!--下发-->
                            <el-button size="gv" icon="el-icon-delete"
                                        type="danger" :loading="loading" @click="recovery(scope.$index, scope.row)"
                                        >{{$t('channelTurnDown.table.turnDown')}}</el-button>
                        </template>
                    </el-table-column>
                    <!--频道编号-->
                    <el-table-column prop="channelId" min-width="150" fixed="left"
                                        :label="$t('channelTurnDown.table.channelId')" sortable="custom" sort-by="code">
                    </el-table-column>
                    <!--频道名称-->
                    <el-table-column prop="channelName" min-width="180" fixed="left"
                                        :label="$t('channelTurnDown.table.channelName')" sortable="custom" sort-by="name">
                    </el-table-column>
                    <!--频道类型-->
                    <!-- <el-table-column prop="type" min-width="110"
                                        :label="$t('channelTurnDown.table.type')" sortable="custom" sort-by="type">
                    </el-table-column> -->
                    <!--状态-->
                    <el-table-column prop="status" min-width="110"
                                        :label="$t('channelTurnDown.table.status')" sortable="custom" sort-by="status">
                    </el-table-column>

                    <!--直播开始时间-->
                    <el-table-column prop="liveStartTime" min-width="180"
                                        :label="$t('channelTurnDown.table.liveStartTime')" sortable="custom" sort-by="expireEndTime">
                    </el-table-column>
                    <!--直播结束时间-->
                    <el-table-column prop="liveEndTime" min-width="180"
                                        :label="$t('channelTurnDown.table.liveEndTime')" sortable="custom" sort-by="expireEndTime">
                    </el-table-column>
                    <!--创建时间-->
                    <el-table-column prop="createTime" min-width="180"
                                        :label="$t('channelTurnDown.table.createTime')" sortable="custom" sort-by="createTime">
                    </el-table-column>
                    <!--最后修改时间-->
                    <el-table-column :label="$t('channelTurnDown.table.lastUpdateTime')" min-width="180" sortable="custom" prop="lastUpdateTime" sort-by="lastUpdateTime">
                    </el-table-column>
                    <!--最后修改人-->
                    <el-table-column :label="$t('channelTurnDown.table.lastUpdatedBy')" min-width="180" sortable="custom" prop="lastUpdatedBy" sort-by="lastUpdatedBy">
                    </el-table-column>

                </el-table>


            </div>
        </div>
        <!--分页-->
        <div class="pageBox">
            <el-pagination @size-change="sizeChange"
                            @current-change="currentPageChange"
                            :current-page="pager.curPage"
                            :page-sizes="pager.sizes"
                            :page-size="pager.curSize"
                            :background="true"
                            layout="total, sizes, prev, pager, next, jumper" :total="pager.total">
            </el-pagination>
        </div>

        <!--编辑对话框-->
        <el-dialog :title="$t('label.dialogTitle')" :visible.sync="isShowEditForm" top="5vh">
            <el-form :model="editForm" ref="editForm" size="mini"
                     :label-position="editFormPosition" status-icon=status-icon :rules="editRules">

                <!--频道名称-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.name')" :label-width="editformLabelWidth" prop="name">
                    <el-input v-model.trim="editForm.name" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.name')"></el-input>
                </el-form-item>
                <!--频道类型-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.type')" :label-width="editformLabelWidth">
                    <el-select v-model="editForm.type">
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType1')" value="shellAssetsType1"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType2')" value="shellAssetsType2"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType3')" value="shellAssetsType3"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsType4')" value="shellAssetsType4"></el-option>
                    </el-select>
                </el-form-item>
                <!--频道来源-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.source')" :label-width="editformLabelWidth">
                    <el-select v-model="editForm.source">
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource1')" value="shellAssetsSource1"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource2')" value="shellAssetsSource2"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource3')" value="shellAssetsSource3"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource4')" value="shellAssetsSource4"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource5')" value="shellAssetsSource5"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource6')" value="shellAssetsSource6"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.shellAssetsSource7')" value="shellAssetsSource7"></el-option>
                    </el-select>
                </el-form-item>
                <!--频道提供方信息-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.sourceInfo')" :label-width="editformLabelWidth" prop="sourceInfo">
                    <el-input v-model.trim="editForm.sourceInfo" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.sourceInfo')"></el-input>
                </el-form-item>
                <!--版权开始时间-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.expireTime')" :label-width="editformLabelWidth" prop="expireTime">
                    <el-date-picker v-model="editForm.expireTime" type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                </el-form-item>
                <!--版权结束时间-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.expireEndTime')" :label-width="editformLabelWidth" prop="expireEndTime">
                    <el-date-picker v-model="editForm.expireEndTime" type="date" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                </el-form-item>
                <!--首字母-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.initials')" :label-width="editformLabelWidth" prop="initials">
                    <el-input v-model.trim="editForm.initials" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.initials')"></el-input>
                </el-form-item>
                <!--年份-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.years')" :label-width="editformLabelWidth" prop="years">
                    <el-date-picker v-model="editForm.years" type="year" :placeholder="$t('ParentAssetIssuance.label.pleaseSelectTime')"></el-date-picker>
                </el-form-item>
                <!--地区-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.area')" :label-width="editformLabelWidth">
                    <el-select v-model="editForm.area">
                        <el-option :label="$t('ParentAssetIssuance.label.area1')" value="area1"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.area2')" value="area2"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.area3')" value="area3"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.area4')" value="area4"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.area5')" value="area5"></el-option>
                    </el-select>
                </el-form-item>
                <!--语言-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.language')" :label-width="editformLabelWidth" prop="language">
                    <el-input v-model.trim="editForm.language" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.language')"></el-input>
                </el-form-item>
                <!--集数-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.episode')" :label-width="editformLabelWidth" prop="episode">
                    <el-input v-model.trim="editForm.episode" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.episode')"></el-input>
                </el-form-item>
                <!--导演-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.director')" :label-width="editformLabelWidth" prop="director">
                    <el-input v-model.trim="editForm.director" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.director')"></el-input>
                </el-form-item>
                <!--编辑-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.edit')" :label-width="editformLabelWidth" prop="edit">
                    <el-input v-model.trim="editForm.edit" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.edit')"></el-input>
                </el-form-item>
                <!--演员-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.actor')" :label-width="editformLabelWidth" prop="actor">
                    <el-input v-model.trim="editForm.actor" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.actor')"></el-input>
                </el-form-item>
                <!--播出状态-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.playStatus')" :label-width="editformLabelWidth">
                    <el-select v-model="editForm.playStatus">
                        <el-option :label="$t('ParentAssetIssuance.label.playStatus1')" value="playStatus1"></el-option>
                        <el-option :label="$t('ParentAssetIssuance.label.playStatus2')" value="playStatus2"></el-option>
                    </el-select>
                </el-form-item>
                <!--评分-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.score')" :label-width="editformLabelWidth" prop="score">
                    <el-input v-model.trim="editForm.score" maxlength="20"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.score')"></el-input>
                </el-form-item>
                <!--简介-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.introduction')" :label-width="editformLabelWidth" prop="introduction">
                    <el-input v-model.trim="editForm.introduction" maxlength="300"  type="textarea"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.introduction')"></el-input>
                </el-form-item>
                <!--剧情-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.plot')" :label-width="editformLabelWidth" prop="plot">
                    <el-input v-model.trim="editForm.plot" maxlength="300"  type="textarea"
                              :placeholder="$t('ParentAssetIssuance.label.placeholder')+$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.plot')"></el-input>
                </el-form-item>
                <!--海报-->
                <el-form-item :label="$t('ParentAssetIssuance.editLabel.ParentAssetIssuance.poster')" :label-width="editformLabelWidth" prop="poster">
                    <el-upload v-model.trim="editForm.poster" class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                               :on-preview="handlePreview" :on-remove="handleRemove"
                               :file-list="fileList2" list-type="picture"> <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <!--取消按钮-->
                <el-button size="mini" @click="isShowEditForm = false" :loading="loading">{{ $t('btnText.cancelBtnText') }}</el-button>
                <!--保存按钮-->
                <el-button size="mini" type="primary" @click="submitForm('editForm')" :loading="loading">{{ $t('btnText.saveBtnText') }}</el-button>
            </div>
        </el-dialog>

        <!--详情对话框-->
        <el-dialog :title="$t('label.dialogDetails')" :visible.sync="isShowDetails" top="5vh" width="60%">
            <el-tabs v-model="activeName" type="border-card">
            <el-tab-pane label="频道信息" name="first">
                <channel-info :datas="dataForm"></channel-info>
            </el-tab-pane>
            </el-tabs>
        </el-dialog>

        <!-- 下发对话框 -->
        <!-- <transition enter-active-class="animated rotateIn" leave-active-class="animated rotateOut">
        <el-dialog :title="$t('AssetIssuance.label.launchDialogTitle')" :visible.sync="isShowEditForm2" top="5vh">
            <el-form :inline="true" :model="editForm" ref="editForm" size="mini"
                     :label-position="editFormPosition" status-icon=status-icon :rules="editRules">

            <el-row>
              <el-form-item :label="$t('')" :label-width="editformLabelWidth">

                    <el-checkbox :label="$t('AssetIssuance.editLabel.move')" name="Move"></el-checkbox>
                    <el-checkbox :label="$t('AssetIssuance.editLabel.telecomN')" name="TelecomN"></el-checkbox>
                    <el-checkbox :label="$t('AssetIssuance.editLabel.telecomS')" name="TelecomS"></el-checkbox>
                    <el-checkbox :label="$t('AssetIssuance.editLabel.unicom')" name="Unicom"></el-checkbox>

                </el-form-item>
            </el-row>

            </el-form>
            <div slot="footer">
                <el-button size="mini" @click="isShowEditForm2 = false" :loading="loading">{{ $t('btnText.cancelBtnText') }}</el-button>
                <el-button size="mini" type="primary" @click="submitForm2('editForm')" :loading="loading">{{ $t('btnText.saveBtnText') }}</el-button>
            </div>

        </el-dialog>
      </transition> -->

  </div>


</template>

<script>

import comBaseVue from '../../baseViewModel';
import ChannelInfo from './ChannelInfo';

export default {
  mixins: [comBaseVue],
  name:'ChannelTurnDown',
  data () {

    return {
        isShowActor:  false,
        isShowDetails:false,
        isShowEditForm2: false,
        activeName: 'first',
        isInit:false,
        tableHeight:100,
        queryformLabelWidth:"84px",
        appDivStyle:{
            height:this.$store.getters.appHeight,
        },
        modelName:"live.model.ChannelTurnDown",//操作的实体类

        fileList2: [],
        //
        changeLogData:[],
        // 查询条件
        formQueryCondition: {
            code: {
                //mapName: 'code',  映射的别名 在同时查询一个属性时需要别名
                //gName:'code',   组名
                op: 'LIKE', // 操作符
                val: '' // 查询的值
            },
            name: {
                op: 'LIKE',
                val: ''
            },
            source: {
                val: ''
            },
            type: {
                val: ''
            },
            status: {
                val: ''
            },
            createTimeStart: {
                val: ''
            },
            createTimeEnd: {
                val: ''
            },
            lastUpdateTimeStart: {
                val: ''
            },
            lastUpdateTimeEnd: {
                val: ''
            },
            expireTime: {
                val: ''
            },
            expireEndTime: {
                val: ''
            },
        },

        // 编辑面板绑定的对象
        editForm: {
            keyID: 0,
            version: 0,
            name: "",
            type: "",
            source: "",
            userStatus: "",
            boxType: "",
            operator: "",

            tname: "",
            type: "",
            source: "",
            sourceInfo: "",
            expireTime: "",
            expireEndTime: "",
            classification: "",
            initials: "",
            years: "",
            area: "",
            language: "",
            episode: "",
            director: "",
            edit: "",
            actor: "",
            playStatus: "",
            boxOffice: "",
            score: "",
            introduction: "",
            plot: "",
            poster: "",
        },
        // 编辑面板的验证规则
        editRules: {
            name: [{ required: true, message: this.$i18n.t('ParentAssetIssuance.label.placeholder')+this.$i18n.t('ParentAssetIssuance.editLabel.ParentAssetIssuance.name'), trigger: 'blur' }],
        },
        dataForm: {
            keyID: 0,
            version: 0,
            code: "",
            name: "",
            source: "",
            type: "",
            providerInfo:"",
            status:"",
            createTime:"",
            updateTime:"",
            tag:"",
            sort:"",
            copyRightTimeS:"",
            copyRightTimeE:"",
            copyRightSource:"",
            copyRightRemark:"",
            cnName:"",
            firstChar:"",
            year:"",
            area:"",
            language:"",
            count:"",
            contentSort:"",
            director:"",
            adaptor:"",
        },
        sort:{
            key: "lastUpdateTime",
            dir: "Desc"
        }
    }
  },
  methods:{
    // 新增
    onNew: function() {
        this.isShowEditForm = true;
        if (this.$refs['editForm']) {
            this.$refs['editForm'].resetFields();
        }
        this.editForm.keyID = "";
        this.editForm.version = "";
        this.editForm.name = "";//"频道名称",
        this.editForm.type = "shellAssetsType1";//"频道类型",
        this.editForm.source = "shellAssetsSource1";//"频道来源",
        this.editForm.sourceInfo = "";//"频道提供方信息",
        this.editForm.expireTime = "";//"版权开始时间",
        this.editForm.expireEndTime = "";//"版权结束时间",
        this.editForm.classification = "";//"频道类型",
        this.editForm.initials = "";//"首字母",
        this.editForm.years = "2018";//"年份",
        this.editForm.area = "area1";//"地区",
        this.editForm.language = "";//"语言",
        this.editForm.episode = "";//"集数",
        this.editForm.director = "";//"导演",
        this.editForm.edit = "";//"编辑",
        this.editForm.actor = "";//"演员",
        this.editForm.playStatus = "playStatus1";//"播出状态",
        this.editForm.boxOffice = "";//"票房",
        this.editForm.score = "";//"评分",
        this.editForm.introduction = "";//"简介",
        this.editForm.plot = "";//"剧情",
        this.editForm.poster = "";//"海报",
        this.curCommand = "SaveNew";
        this.canEditCode = false;
    },

     // 重置
    onReset:function(){
        if (this.$refs['form']) {
            this.$refs['form'].resetFields();
        }
        this.formQueryCondition.code.val = "";
        this.formQueryCondition.name.val = "";
        this.formQueryCondition.source.val = "";
        this.formQueryCondition.type.val = "";
        this.formQueryCondition.status.val = "";
        this.formQueryCondition.createTimeStart.val = "";
        this.formQueryCondition.createTimeEnd.val = "";
        this.formQueryCondition.lastUpdateTimeStart.val = "";
        this.formQueryCondition.lastUpdateTimeEnd.val = "";
        this.formQueryCondition.expireTime.val = "";
        this.formQueryCondition.expireEndTime.val = "";
    },

    // 授权按钮单击事件
    editMenu: function(index, row) {

    },
    //回退事件
    back: function(isSuccess, json) {
        //this.$router.go(-1);//后退
        this.$parent.setCurrentComponent("goBack",null);
    },
    //下发按钮单机事件
    recovery: function(index, row) {
        this.queryModelByKeyID(
        this.modelName,
        row.keyID,
        "Query",
        this.recoveryCallback);
        },
        //下发回掉事件
        recoveryCallback: function(isSuccess,json) {
        if(isSuccess){
            this.curCommand = "UpdateProc";
            this.isShowEditForm2 = true;
            if (this.$refs['editForm']) {
                this.$refs['editForm'].resetFields();
            }
            this.editForm.keyID = json.keyID;
            this.editForm.version = json.version;
            this.editForm.applicablePlatform = json.applicablePlatform;
            this.canEditCode = true;
        }
        else{
            this.$message({
                message: json.msg,
                type: 'warning'
                });
        }
    },
    // 批量下发点击事件
    recoverys: function(){
        this.isShowEditForm2 = true;
    },
    // 提交下发界面数据
    submitForm2: function submitForm2(formName) {
            var _this = this;

            this.$refs[formName].validate(function (valid) {
                if (valid) {
                    _this.loading = true;
                    _this.procCommand(_this.curCommand,
                    _this.modelName,
                    "Default",
                    _this.editForm,
                    _this.submitForm2Callback);
                } else {
                    return false;
                }
            });
        },
        // 执行命令后的回调函数
        submitForm2Callback: function submitForm2Callback(isSuccess,json) {
            this.loading = false;
            if(isSuccess){
                this.isShowEditForm2 = false;
                this.$message({
                    message: this.$i18n.t("message.successTip"),//resource.message.successTip,
                    type: 'success'
                });
                this.queryTable();
            }
            else
            {
                this.$message({
                                message: json.msg,
                                type: 'warning'
                                });
            }
        },
    // 编辑按钮回调事件
    editCallback: function(isSuccess,json) {
        if(isSuccess){
            this.curCommand = "UpdateProc";
            this.isShowEditForm = true;
            if (this.$refs['editForm']) {
                this.$refs['editForm'].resetFields();
            }
            this.editForm.keyID = json.keyID;
            this.editForm.version = json.version;
            this.editForm.name = json.name;//"频道名称",
            this.editForm.type = json.type;//"频道类型",
            this.editForm.source = json.source;//"频道来源",
            this.editForm.sourceInfo = json.sourceInfo;//"频道提供方信息",
            this.editForm.expireTime = json.expireTime;//"版权开始时间",
            this.editForm.expireEndTime = json.expireEndTime;//"版权结束时间",
            this.editForm.classification = json.classification;//"频道类型",
            this.editForm.initials = json.initials;//"首字母",
            this.editForm.years = json.years;//"年份",
            this.editForm.area = json.area;//"地区",
            this.editForm.language = json.language;//"语言",
            this.editForm.episode = json.episode;//"集数",
            this.editForm.director = json.director;//"导演",
            this.editForm.edit = json.edit;//"编辑",
            this.editForm.actor = json.actor;//"演员",
            this.editForm.playStatus = json.playStatus;//"播出状态",
            this.editForm.boxOffice = json.boxOffice;//"票房",
            this.editForm.score = json.score;//"评分",
            this.editForm.introduction = json.introduction;//"简介",
            this.editForm.plot = json.plot;//"剧情",
            this.editForm.poster = json.poster;//"海报",
            this.canEditCode = true;

        }
        else{
            this.$message({
                message: json.msg,
                type: 'warning'
                });
        }
    },

    handleRemove(file, fileList) {
        console.log(file, fileList);
      },
    handlePreview(file) {
        console.log(file);
    },

    // 详情按钮单击事件
    clickDetails: function(index, row) {
       this.queryModelByKeyID(this.modelName,row.keyID,"Query",this.showDetails);

    },
    // 详情按钮回调事件
    showDetails: function(isSuccess,json) {
       console.log(json);
        if(isSuccess){
            this.curCommand = "UpdateProc";
            this.isShowDetails = true;
            this.dataForm = json;
            // if (this.$refs['dataForm']) {
            //     this.$refs['dataForm'].resetFields();
            // }

            // this.dataForm.keyID=json.keyID;
            // this.dataForm.version=json.version;
            // this.dataForm.code=json.code;
            // this.dataForm.name = json.name;//"频道名称",
            // this.dataForm.type = json.type;//"频道类型",
            // this.dataForm.source = json.source;//"频道来源",
            // this.dataForm.sourceInfo = json.sourceInfo;//"频道提供方信息",
            // this.dataForm.expireTime = json.expireTime;//"版权开始时间",
            // this.dataForm.expireEndTime = json.expireEndTime;//"版权结束时间",
            // this.dataForm.classification = json.classification;//"频道类型",keyID: 0,
            // this.dataForm.providerInfo = json.providerInfo;
            // this.dataForm.status = json.status;
            // this.dataForm.createTime = json.createTime;
            // this.dataForm.updateTime = json.updateTime;
            // this.dataForm.tag = json.tag;
            // this.dataForm.sort = json.sort;
            // this.dataForm.copyRightTimeS = json.copyRightTimeS;
            // this.dataForm.copyRightTimeE = json.copyRightTimeE;
            // this.dataForm.copyRightSource = json.copyRightSource;
            // this.dataForm.copyRightRemark = json.copyRightRemark;
            // this.dataForm.cnName = json.cnName;//"首字母",
            // this.dataForm.years = json.years;//"年份",
            // this.dataForm.area = json.area;//"地区",
            // this.dataForm.language = json.language;//"语言",
            // this.dataForm.firstChar = json.firstChar;//"集数",
            // this.dataForm.count = json.count;//"导演",
            // this.dataForm.contentSort = json.contentSort;//"编辑",
            // this.dataForm.adaptor = json.adaptor;//"演员",
            // this.dataForm.director = json.director;//"播出状态",


            }
        else{
            this.$message({
                message: json.msg,
                type: 'warning'
                });
        }
    },
    handleClick(tab, event) {
        console.log(tab, event);
    },

     // 跳转到节目单管理
    onPlayBill: function(index, row) {
        this.queryModel("live.model.PlayBillManage","Query",{channelName: {val: row.channelName}},this.pager,this.sort,this.playBillCallback);

    },

    playBillCallback: function(isSuccess,json) {
        if(isSuccess){
            this.tableDatas = [];
                    for (var i = 0; i < json.queryResult.length; i++) {
                        this.tableDatas.push(json.queryResult[i]);
                    }
            this.$parent.setCurrentComponent("PlayBillManage",{curProps:this.tableDatas,isNeedGoBack:true });
        }

    },

    initTable:function(){
        //alert("setTimeout");
        this.tableHeight = this.$refs.context.offsetHeight - this.$refs.queryBox.offsetHeight;
        this.isInit = true;
    },

  },
  mounted: function mounted() {
    this.onQuery();
    window.setTimeout(this.initTable,100);
  },
  components: {
    "channel-info": ChannelInfo
  }
}


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
